function DadosObjeto(){
    var  dados = null;
    this.getDados = getDados;
    this.xmlhttpPost = xmlhttpPost;
    this.invocarVoid = invocarVoid;

    function getDados(){
        return dados;
    }

    function createXMLHttpRequest(){
        if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
            try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
            try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
            try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
            try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
            throw new Error( "This browser does not support XMLHttpRequest." )
        };
        return new XMLHttpRequest();
    }

    function xmlhttpPost(nomeClasse,id) {
        try{
            var xmlHttpReq = false;
            var self = this;
            var arrayTela = null;
            self.xmlHttpReq = createXMLHttpRequest();
            self.xmlHttpReq.open('POST',"pagina_json.jsp",false);//pagina retorna json
            self.xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
            self.xmlHttpReq.onreadystatechange = function() {
                if(self.xmlHttpReq.readyState == 2){
                } else if (self.xmlHttpReq.readyState == 4) {//retorno da pagina
                    dados = JsonRosena.parse(self.xmlHttpReq.responseText);//popula json
                }
            }
            //alert(nomeClasse);
            var qstr = 'nomeClasse='+nomeClasse;
            if(id != undefined){
                qstr +='&id='+id;
            }
            self.xmlHttpReq.send(qstr);
        }catch(ex){
            alert(ex.message);
        }
    }

    function invocarVoid(comando,nomeClasse){
        var xmlHttpReq = false;
        var self = this;
        var arrayTela = null;
        self.xmlHttpReq = createXMLHttpRequest();
        self.xmlHttpReq.open('POST',"pagina_json.jsp",false);//pagina retorna json
        self.xmlHttpReq.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
        self.xmlHttpReq.onreadystatechange = function() {
            if (self.xmlHttpReq.readyState == 4) {//retorno da pagina
                dados = JsonRosena.parse(self.xmlHttpReq.responseText);//popula jso
                if(dados.error != ""){
                    alert(dados.error);
                }else{
                    if(dados.id >0){
                        document.getElementById("toString").innerHTML = nomeClasse+",ID "+dados.id;
                    }else{
                        document.getElementById("toString").innerHTML = "";                                        
                    }
                }
            }
        }
        var qstr = 'toStringJson='+escape(getDados().toJsonRosenaString());
        qstr += "&comando="+comando;
        qstr += "&nomeClasse="+nomeClasse;
        self.xmlHttpReq.send(qstr);
    }
}
